﻿@using Localization.Resources.AbpUi
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Abp.MultiTenancy
@using Volo.Abp.UI.Navigation
@using Volo.Abp.Users

@inject ICurrentUser CurrentUser
@inject ICurrentTenant CurrentTenant


@model ApplicationMenu
    <!-- Nav Item - User Information -->
<li class="nav-item dropdown no-arrow">
    <a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
        <span class="mr-2 d-none d-lg-inline text-gray-600 small"> @CurrentUser.UserName</span>
        <img class="img-profile rounded-circle" src="https://source.unsplash.com/QAB-WJcbgJk/60x60">
    </a>

    @if (Model.Items.Any())
    {
        <!-- Dropdown - User Information -->
        <div class="dropdown-menu dropdown-menu-right shadow animated--grow-in" aria-labelledby="userDropdown">
            @foreach (var menuItem in Model.Items)
            {
                var elementId = string.IsNullOrEmpty(menuItem.ElementId) ? string.Empty : $"id=\"{menuItem.ElementId}\"";
                var cssClass = string.IsNullOrEmpty(menuItem.CssClass) ? string.Empty : menuItem.CssClass;
                var disabled = menuItem.IsDisabled ? "disabled" : string.Empty;
                var icon = string.IsNullOrEmpty(menuItem.Icon) ? string.Empty : menuItem.Icon;

                <a class="dropdown-item  @cssClass @disabled" href="@(menuItem.Url ?? " #")" @Html.Raw(elementId)>
                    <i class="fas @icon fa-sm fa-fw mr-2 text-gray-400"></i>
                    @menuItem.DisplayName
                </a>
            }
        </div>
    }

</li>
